<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE>
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<jsp:include page="/static/iframe/import/_meta.jsp"></jsp:include>
<jsp:include page="/static/iframe/import/_header.jsp"></jsp:include>
<link rel="stylesheet"
	href="static/iframe/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet"
	href="static/iframe/bootstrap/css/bootstrapValidator.min.css">
<link rel="stylesheet"
	href="static/iframe/bootstrap/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css">
<link rel="stylesheet"
	href="static/iframe/bootstrap/bootstrap-select/css/bootstrap-select.min.css">

<title>修改收派标准</title>

<style>
.input-margin-bottom {
	margin-bottom: 20px;
}
.form-horizontal .form-group{height:48px;
  margin-left: 0px;margin-right:0px;
}

</style>
</head>
<body>

	<div class="page-container">
		<div class="container-fluid">
			<form class="form-horizontal" method="post"  id="myform">
			<input type="hidden"  id="id"  name="id"  value="${pickstandard.id}">
				<div class="row">
					<div class="col-sm-4 col-md-4 col-lg-3">
						<div class="form-group">
							<div class="input-group">
								<span class="input-group-addon"> <span  class="text-danger">*&nbsp;</span>&nbsp;标&nbsp;准&nbsp;名&nbsp;称&nbsp;
								</span> <input type="text" class="form-control" placeholder="标准名称"
									name="standardName"  value="${pickstandard.standardName}"/>
							</div>
						</div>
					</div>


					<div class="col-sm-4 col-md-4 col-lg-3 ">
						<div class="form-group">
							<div class="input-group">
								<span class="input-group-addon"><span  class="text-danger">*&nbsp;</span>&nbsp;最&nbsp;小&nbsp;重&nbsp;量&nbsp;</span>
								<input type="text" class="form-control" name="minWeight"
									placeholder="最小重量" value="${pickstandard.minWeight }"/>
							</div>
						</div>
					</div>

							<div class="col-sm-4 col-md-4 col-lg-3 ">
						<div class="form-group">
							<div class="input-group">
								<span class="input-group-addon"><span  class="text-danger">*&nbsp;</span>&nbsp;最&nbsp;大&nbsp;重&nbsp;量&nbsp;</span>
								<input type="text" class="form-control" name="maxWeight"
									placeholder="最大重量" value="${pickstandard.maxWeight}"/>
							</div>
						</div>
					</div>
					
					
					
					
				<div class="col-sm-12 col-md-12 col-lg-12 text-center">
					<div class="tooltip-demo">
					<div class="form-bottom">
						<button type="submit"  class="btn btn-primary">
							<i class="glyphicon glyphicon-ok"></i>&nbsp;提交
						</button>
						&nbsp;
						<button class="btn btn-success" type="reset" id="reset">
							<i class="glyphicon glyphicon-refresh"></i>&nbsp;重置
						</button>
						&nbsp; <a class="btn btn-white" href="javascript:layer_close()"
							target="_blank"><i class="glyphicon glyphicon-share-alt"></i>&nbsp;返回</a>
					 </div>
					</div>
				</div>
			</form>
		</div>
	</div>
	
<jsp:include page="/static/iframe/import/_footer.jsp"></jsp:include>
<script type="text/javascript"
	src="static/iframe/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript"
	src="static/iframe/bootstrap/js/bootstrapValidator.min.js"></script>
<script type="text/javascript"
	src="static/iframe/bootstrap/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript"
	src="static/iframe/bootstrap/bootstrap-datetimepicker/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript" src="static/plugins/window/layershow.js"></script>
<script type="text/javascript" src="static/plugins/window/referparent.js"></script>
<script type="text/javascript"
	src="static/iframe/bootstrap/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript"
	src="static/iframe/bootstrap/bootstrap-select/js/defaults-zh_CN.min.js"></script>

	
<script type="text/javascript">
  $(function(){
	  
	  console.info($("#id").val());
	  /*日期控件*/
		$(".date").datetimepicker({
			language: 'zh-CN', //显示中文
			format: 'yyyy-mm-dd', //显示格式
			minView: "month", //设置只显示到月份
			endDate: new Date(),
			autoclose: true, //选中自动关闭
			todayBtn: true, //显示今日按钮
			clearBtn: true
			//清空输入时间
		});
	
	  
	  $("#myform").bootstrapValidator({
			feedbackIcons: {
							valid: 'glyphicon glyphicon-ok',
							invalid: 'glyphicon glyphicon-remove',
							validating: 'glyphicon glyphicon-refresh'
			},/*
			fields : {
				organizationName : {
					message : '部门名验证失败',
					validators : {
						notEmpty : {
							message : '部门名不能为空'
						},
						remote : {
							type : 'post',
							url : 'organization/checkOrganizationName',
							message : '该部门已经存在!',
							delay :1000
						}
					}
				},*/
				roleCode : {
					validators : {
						notEmpty : {
							message : '部门code不能为空'
						}
					}
				}
			//做ajax请求用到
		}).on('success.form.bv', function(e) {
			e.preventDefault();
			var $form = $(e.target); //拿到form表单
			 layer.load(2,{time:1000});
			setTimeout(function(){
				//请求修改部门
			 	$.ajax({
					type:"post",
					url:"pickstandard/update",
					dataType:"json",
					data:$form.serialize(),
					success:function(result){
						if(result.flag){
							 layer.msg(result.msg,{time:1500,icon:1});
							 setTimeout(function(){
								 window.parent.location.reload();
							 },1500);
						}else{
							layer.msg(result.msg,{time:1500,icon:2});
						}
					},
					error:function(result) {
			              layer.msg(result.msg,{time:1500,icon:2});
					},
				});
			},1000);
	     });
		
		
		$("#reset").click(function(){
			loadDeptNames();
			$("#myform").data('bootstrapValidator').resetForm();
			
		});
		
		  //加载锁
		  $("#locked option[value='"+$("#lockedvalue").val()+"']").attr('selected',true);
   });
  
</script>
<script type="text/javascript">

//配置
var setting = {
		view: {
        dblClickExpand: true,
        selectedMulti: true, //是否允许多选
        txtSelectedEnable: true, //是否允许选中节点的文字
        autoCancelSelected: true, //不允许按下Ctrl键取消节点选中状态
    },
    data: {
        simpleData: {
            enable: true
        }
    },
    callback: {
        onClick: onClick
    }
};

  //点击节点时
function onClick(e, treeId, treeNode) {
  	//获取树
    var zTree = $.fn.zTree.getZTreeObj("deptTree");  
  	//获取所有的节点
    var nodes = zTree.getSelectedNodes(),
		v = "";
  	id="";
    nodes.sort(function compare(a, b) { return a.id - b.id; });
    for (var i = 0, l = nodes.length; i < l; i++) {
        v += nodes[i].deptname + ",";
        id +=nodes[i].id+",";
    }
    if (id.length > 0)id = id.substring(0, id.length - 1);
    if (v.length > 0) v = v.substring(0, v.length - 1);
  
       //资源名称
       $("#deptName").val(v);
       //资源编号
       $("#deptno").val(id);
       //点击后隐藏
       $("#myform").data("bootstrapValidator").updateStatus("deptName",  "VALID", null );
       hideMenu();
    return false;
}
  //显示菜单
function showMenu() {
   
    if($("#deptTree").css("display") == 'none'){
    	 $("#deptTree").stop().show();
    }else{
    	$("#deptTree").stop().hide();
    }
}
  //隐藏菜单
function hideMenu() {
    $("#deptTree").stop().hide();
}
  //点击body时
  /*
function onBodyDown(event) {
    if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length > 0)) {
        hideMenu();
    }
}*/
  //加载时发生
  /*
$(document).ready(function () {
	 var zNodes;
	 //获取数据
     $.getJSON('dept/Tree',function(data){
    	 //初始化tree
    	 $.fn.zTree.init($("#deptTree"), setting, data);
        });
});

  function loadDeptNames(){
	  //加载部门名称
	  $.ajax({
			type: 'get',
			url: 'user/showName',
			dataType: 'json',
			data : {
				    "id": $("#showname").val()
				},
			success: function(data){
				$("#deptName").val(data.msg);
			 },
			error:function(data) {
			},
		});
  }
  */
</script>
	
	
	<!--[if lt IE 10]>
    <script type="text/javascript" src="static/plugins/js/input-placeholder/ieplaceholder.js"></script>
    <![endif]-->

</body>
</html>